<?php
/**
*
* Order items view
*
* @package	VirtueMart
* @subpackage Orders
* @author Max Milbers, Valerie Isaksen
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: details_items.php 5432 2012-02-14 02:20:35Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

$colspan=8;

if ($this->doctype != 'invoice') {
    $colspan -= 4;
} elseif ( ! VmConfig::get('show_tax')) {
    $colspan -= 1;
}

$product_model = VmModel::getModel('product');

 ?>
<table class="html-email" width="100%" cellspacing="0" cellpadding="0" border="0">
	<tr align="left" class="sectiontableheader">
		<td align="left"><strong><?php echo JText::_('COM_VIRTUEMART_MAIL_ITEMID') ?></strong></td>
		<td align="left" colspan="2"><strong><?php echo JText::_('COM_VIRTUEMART_MAIL_ITEMNAME') ?></strong></td>
		<td align="left"><strong><?php echo JText::_('COM_VIRTUEMART_UNITCONVERSION') ?><strong></td>
		<td align="right"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></strong></td>
	</tr>

<?php

	foreach($this->orderDetails['items'] as $item) {
		$qtt = $item->product_quantity ;
		$product = $product_model->getProduct($item->virtuemart_product_id,TRUE,TRUE,TRUE,$quantity);
		$product_link = JURI::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id .
			'&virtuemart_product_id=' . $item->virtuemart_product_id;

		?>
		<tr valign="top">
			<td align="left">
				<?php echo $item->order_item_sku; ?>
			</td>
			<td align="left" colspan="2" >
				<a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a>
				<?php
					if (!empty($item->product_attribute)) {
							if(!class_exists('VirtueMartModelCustomfields'))require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'customfields.php');
							$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
						echo $product_attribute;
					}
				?>
			</td>
			<td><?php echo nl2br($product->metakey);?></td>
			<td><?php echo $qtt;?></td>
		</tr>

<?php
	}
?>

</table>
<?php if($this->orderDetails['details']['BT']->customer_note!=''):?>
<h3>Note:</h3>
<p style="background:#fff; padding:9px;"><?php echo $this->orderDetails['details']['BT']->customer_note;?></p>
<hr>
<?php endif;?>